<?php
if($product):
$titlePr = 'title'.$rear;
$aliasPr = 'alias'.$rear;
$detailPr = 'detail'.$rear;
$tygia = $this->common_model->getone('setting',array('id'=>1),array('tygia'));
$tygia = $tygia->tygia;
if(is_numeric($tygia)){}else{$tygia = 21000;}
$currency = $this->session->userdata('currency');
?>
<div class="module-product detail_pro">
	<div class="product-title title-pro">
		<div class="box-title">
			<h3><?php echo $product->$titlePr ?></h3>
			
		</div>
	</div><!-- end highlight-title -->
	
	<div class="article-content clearfix" style="padding:10px 20px 10px 10px">
        
        <div class="images-product fLeft">
            <img width="280px" alt="<?php echo $product->$titlePr; ?>" src="<?php if(empty($product->image)){$product->image='/images/so_006.png';} echo base_url().$product->image; ?>" />
        </div>
        <div class="intro-product fRight">
            <form method="POST" action="<?php echo base_url().'cart/add/'.$product->id;?>">
                <p><?php echo $this->lang->line('code') ?>: <span><?php echo $product->code; ?></span></p>
                <p><?php echo $this->lang->line('price') ?>: <span><?php if($currency == 'usd'){$gia = $product->price;$money = ' USD';}else {$gia = $product->price*$tygia;$gia = round($gia,3);$money = ' VND';} echo $gia.$money; ?></span></p>	
                <?php 
                $manufacturer = $this->common_model->getdata('product_manufacturer');
                foreach($manufacturer as $manu){
                    if($product->manufacturer == $manu->id){
                        $facturer = $manu;
                        break;
                    }
                }
                ?>
                <p>Hãng sản xuất: <span><?php echo $facturer->$titlePr; ?></span></p>
                <p>
                    <?php echo $this->lang->line('quantity') ?>:<input name="qty" class="code" type="text" value="1"/>
                    
                    <input class="buy" type="submit" name="submitcart" value="<?php echo $this->lang->line('buy') ?>"/>
                </p>
            </form>
            <script type="text/javascript">
                $(document).ready(function(){
                	$('.buy').click(function(){
                	   
                	});
                });
            </script>
            <div id="groupsocial">
                <ul>
                    <li class="lisharebutton" >
                    <a class="sharebutton" id="facebook" title="facebook" onclick="functionshare('facebook')"></a>
                    </li>
                    <li class="lisharebutton" >
                    <a class="sharebutton" id="twitter" title="twitter" onclick="functionshare('twitter')"></a>
                    </li>
                    <li class="lisharebutton" >
                    <a class="sharebutton" id="googleshare" title="googleshare" onclick="functionshare('googleshare')"></a>
                    </li>
                    <li class="lisharebutton" >
                    <a class="sharebutton" id="printf" title="printf" onclick="javascript:window.print()"></a>
                    </li>
                </ul>
            </div>
            
            <div id="fb-root"></div>
            <script>
                (function(d, s, id) {
                    var js, fjs = d.getElementsByTagName(s)[0];
                    if (d.getElementById(id)) return;
                    js = d.createElement(s); js.id = id;
                    js.src = "//connect.facebook.net/<?php if($rear == '_en')echo 'en_US'; else echo 'vi_VN'; ?>/all.js#xfbml=1";
                    fjs.parentNode.insertBefore(js, fjs);
                }(document, 'script', 'facebook-jssdk'));
            </script>
            <div class="fb-like" data-href="<?php echo base_url().$this->uri->uri_string().'.html';?>" data-send="true" data-width="450" data-show-faces="true"></div>
        </div>
        <div class="detail-product fLeft">
            <?php echo $product->$detailPr;?>
        </div>
	</div><!-- end content-news-->
	
	<div class="bottom-pro">
	</div><!-- end bottom-pro-->
	
</div><!--end prohighlight-content -->
<?php
endif;
?>
<script>
$(document).ready(function(){
	var url = window.location.href;
	var title = $('title').text();
	title = escape(title);
	var likeface = '<iframe src="//www.facebook.com/plugins/like.php?href='+url+'&amp;send=false&amp;layout=button_count&amp;width=80&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px; height:21px;" allowTransparency="true"></iframe>';
	$('#likeface').html(likeface);
	$("li.lisharebutton").each(function() {
		$(this).css("opacity", "0.9");
	});
	$("li.lisharebutton").hover(function() {
		$(this)
			.stop().fadeTo(500, 1)
			.siblings().stop().fadeTo(500, 0.2);
	}, function() { // Mouse out
		$(this)
			.stop().fadeTo(500, 0.9)
			.siblings().stop().fadeTo(500, 0.9);
	});
});

function functionshare(id){
	var url = window.location.href;
	var title = $('title').text();
	title = escape(title);
    switch(id){
    	case 'facebook':
            var facebookurl = 'http://www.facebook.com/sharer/sharer.php?u='+url;
            window.open(facebookurl,'','width=600,height=350,toolbar=no,scrollbars=no,left=200,screenX=200,screenY=200,top=200');
            break;
    	case 'twitter':
            var twitterurl = 'http://twitter.com/intent/tweet?source=webclient&text='+url;
            window.open(twitterurl,'','width=600,height=350,toolbar=no,scrollbars=no,top=200,left=200');
            break;
        case 'googleshare':
            var googleshareurl = 'https://plus.google.com/share?url='+url;
            window.open(googleshareurl,'','width=600,height=350,toolbar=no,scrollbars=no,top=200,left=200');
            break;
        case 'printf':
            var printfurl = 'javascript:window.print()';
            $('#printf').attr('href',''+printfurl+'');
            break;
        default:
    		break;
	}
}
</script>